package com.roc.web.action.merinfo;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class MerinfoTempSaveSearchCondtion extends BaseSearchCondition {
	
	private String mchtCd; //商户号
	
	private String nameBusi; //商户简称
	
	private String  minDate; //创建时间开始
	
	private String  maxDate; //创建时间结束
	
	private String operId; //操作员id

	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		if(Constance.isNotEmpty(mchtCd)){ //商户号
			filedBeanList.add(new WhereHQLFieldBean(" t.mcht_cd", mchtCd.trim(), "=", false));
		}
		if(Constance.isNotEmpty(nameBusi)){ //商户简称 （模糊）
			filedBeanList.add(new WhereHQLFieldBean(" t.name_busi", nameBusi.trim(), "like", false,"ALL"));
		}
		if(Constance.isNotEmpty(minDate)&&Constance.isNotEmpty(maxDate)){ //创建时间
			filedBeanList.add(new WhereHQLFieldBean(" to_char(t.rec_crt_ts,'yyyy-MM-dd')",minDate.trim(),">=", false));
			filedBeanList.add(new WhereHQLFieldBean(" to_char(t.rec_crt_ts,'yyyy-MM-dd')",maxDate.trim(),"<=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append(" select count(1) ");
		sb.append(" from tbl_edit_mcht_inf t where t.status='09' and t.rec_upd_opr=").append(operId);
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append(" select t.mcht_cd,t.name_busi,t.status,t.rec_crt_ts,t.rec_upd_opr ");
		sb.append(" from tbl_edit_mcht_inf t where t.status='09' and t.rec_upd_opr=").append(operId);
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		return " order by t.rec_crt_ts desc";
	}

	public String getMchtCd() {
		return mchtCd;
	}

	public void setMchtCd(String mchtCd) {
		this.mchtCd = mchtCd;
	}

	public String getNameBusi() {
		return nameBusi;
	}

	public void setNameBusi(String nameBusi) {
		this.nameBusi = nameBusi;
	}

	public String getMinDate() {
		return minDate;
	}

	public void setMinDate(String minDate) {
		this.minDate = minDate;
	}

	public String getMaxDate() {
		return maxDate;
	}

	public void setMaxDate(String maxDate) {
		this.maxDate = maxDate;
	}

	public String getOperId() {
		return operId;
	}

	public void setOperId(String operId) {
		this.operId = operId;
	}

	
}